package com.hjimi.ski.model.base;

import com.hjimi.ski.callback.BaseCallback;
import com.hjimi.ski.utils.HttpUtil;
import com.zhy.http.okhttp.callback.StringCallback;

import okhttp3.Call;
import okhttp3.Request;

/**
 * Created By 孙岩
 * on 2021/4/15
 */
public class FilePostModel extends BaseModel<String> {
    @Override
    public void execute(final BaseCallback<String> callback) {

            HttpUtil.uploadFile1(url,file , new StringCallback() {
                @Override
                public void onError(Call call, Exception e, int id) {
                    callback.onFailure(e.toString());
                }

                @Override
                public void onResponse(String response, int id) {
                    callback.onSuccess(response);
                }

                @Override
                public void onBefore(Request request, int id) {
                    callback.onBefore();
                }

                @Override
                public void onAfter(int id) {
                    callback.onComplete();
                }
            }, "1");
    }
}
